package com.errol.batchprocessor.employeeaddition.advisorimpl.payroll.payload;

import com.renjia.entity.*;
import com.renjia.enums.EmployeeRegisterSourceEnum;
import com.renjia.service.module.employeeaddition.advisorimpl.EmployeeAdvisorTypeEnum;
import com.renjia.service.module.employeeaddition.advisorimpl.common.payload.AbstractEmployeeBatchPayload;
import com.renjia.service.module.payroll.advisorimpl.PayrollAdvisorTypeEnum;
import com.renjia.service.module.payroll.advisorimpl.payload.PayLimitPayload;
import lombok.Getter;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 费用发放导入批次数据
 *
 * @author zhang xiao bin
 * @version v1.0
 * @date 2021/03/03
 * @since v5.0.6
 **/
@Getter
public class PayrollEmployeeBatchPayload extends AbstractEmployeeBatchPayload<BusPayrollRecord, BusPayrollRecordDetail> {

    private final PayrollAdvisorTypeEnum payrollAdvisorTypeEnum;
    private final String demandId;
    private BusDemand busDemand;
    private volatile PayLimitPayload payLimitPayload;
    private ConcurrentHashMap<String, BigDecimal> map=new ConcurrentHashMap<>();
    /**
     * 接替计费配置
     */
    private List<CoreCustomerPayrollRate> coreCustomerPayrollRateList;

    public PayrollEmployeeBatchPayload(@NonNull String batchNo, @NonNull CoreEmployeeImportBatch importBatch,
                                       @Nullable BusPayrollRecord batchEntity, @NonNull List<BusPayrollRecordDetail> singleEntityList,
                                       @NonNull EmployeeAdvisorTypeEnum employeeAdvisorType, @NonNull EmployeeRegisterSourceEnum employeeRegisterSource,
                                       @NonNull CoreCustomerChannelMerchant coreCustomerChannelMerchant, @NonNull CoreUser coreUser,
                                       @Nullable CoreChannelMerchant coreChannelMerchant, @Nullable CoreCustomer coreCustomer,
                                       @NonNull PayrollAdvisorTypeEnum payrollAdvisorTypeEnum, @NonNull String demandId, @Nullable BusDemand busDemand) {
        super(batchNo, importBatch, batchEntity, singleEntityList, employeeAdvisorType, employeeRegisterSource, coreCustomerChannelMerchant, coreUser, coreChannelMerchant, coreCustomer);
        this.payrollAdvisorTypeEnum = payrollAdvisorTypeEnum;
        this.demandId = demandId;
        this.busDemand = busDemand;
        this.payLimitPayload = null;
        this.coreCustomerPayrollRateList = null;
    }

    public void setBusDemand(BusDemand busDemand) {
        this.busDemand = busDemand;
    }

    public void setPayLimitPayload(PayLimitPayload payLimitPayload) {
        this.payLimitPayload = payLimitPayload;
    }

    public void setCoreCustomerPayrollRateList(List<CoreCustomerPayrollRate> coreCustomerPayrollRateList) {
        this.coreCustomerPayrollRateList = coreCustomerPayrollRateList;
    }
}
